package com.bang.study.filter;

import com.bang.study.batch.ListSplitter;
import com.bang.study.constants.PublicConstants;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.MessageSelector;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;

import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: Bang
 * @Date: 2020/5/6 23:43
 * @Description:
 */
public class SqlProducer {

    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer(PublicConstants.TEST_PRODUCER_GROUP);
        producer.setNamesrvAddr(PublicConstants.NAME_ADDR);
        producer.start();
        for (int i = 0; i < 5; i++) {
            Message msg1 = new Message("FILTER_SQL_TOPIC",  ("我是消息 " + i).getBytes());
            msg1.putUserProperty("a", String.valueOf(i));
            producer.send(msg1);
            Thread.sleep(1000);
        }

        System.out.println("发送成功");
        producer.shutdown();
    }
}
